/**
 *	模块定义
 *	开发者：雨中磐石
 *	地址：www.rockoa.com
 *	日期：2024-07-19
 */

package com.framework.ACore;

import com.framerock.baselib.Rock;

import java.util.Map;

public class ModuleInfo {

    public static ModuleInfo get()
    {
        return new ModuleInfo();
    }

    //模块名称
    private String name = "";

    //模块编号
    private String num = "";

    //分类
    private String type = "";

    //对应主表
    private String table = "";

    //默认图标
    private String imgurl = "";

    private String where =  null;
    private String summary = "";
    private String summarx = "";
    private String sericnum = null;
    private String sortdir =  null;
    private String explain = "";


    private int status = -1;
    private int isxt = -1;
    private int sort = -1;
    private int istj = -1;

    private int islc = -1;

    //---上面一些常量----

    /**
     * 模块名称
     * */
    public ModuleInfo setName(String name) {
        this.name = name;
        return this;
    }

    /**
     * 模块分类
     * */
    public ModuleInfo setType(String type) {
        this.type = type;
        return this;
    }

    /**
     * 对应主表
     * */
    public ModuleInfo setTable(String table) {
        this.table = table;
        return this;
    }

    /**
     * 图标地址
     * */
    public ModuleInfo setImgurl(String imgurl) {
        this.imgurl = imgurl;
        return this;
    }

    /**
     * 模块编号
     * */
    public ModuleInfo setNum(String num) {
        this.num = num;
        return this;
    }

    /**
     * 共用主表必须条件
     * */
    public ModuleInfo setWhere(String where) {
        this.where = where;
        return this;
    }

    /**
     * 摘要
     * */
    public ModuleInfo setSummary(String summary) {
        this.summary = summary;
        return this;
    }

    /**
     * 应用摘要
     * */
    public ModuleInfo setSummarx(String summarx) {
        this.summarx = summarx;
        return this;
    }

    /**
     * 状态
     * */
    public ModuleInfo setStatus(int status) {
        this.status = status;
        return this;
    }

    /**
     * 默认列表排序字段，如id desc
     * */
    public ModuleInfo setSortdir(String sortdir) {
        this.sortdir = sortdir;
        return this;
    }

    /**
     * 排序号越大越靠后
     * */
    public ModuleInfo setSort(int sort) {
        this.sort = sort;
        return this;
    }

    /**
     * 编号规则
     * */
    public ModuleInfo setSericnum(String sericnum) {
        this.sericnum = sericnum;
        return this;
    }

    /**
     * 模块级别@0|默认,1|系统级,2|单位级
     * */
    public ModuleInfo setIsxt(int isxt) {
        this.isxt = isxt;
        return this;
    }

    /**
     * 单位是否可用添加此模块
     * */
    public ModuleInfo setIstj(int istj) {
        this.istj = istj;
        return this;
    }

    /**
     * 模块说明
     * */
    public ModuleInfo setExplain(String explain) {
        this.explain = explain;
        return this;
    }

    /**
     * 是否可开启流程
     * */
    public ModuleInfo setIslc(int islc) {
        this.islc = islc;
        return this;
    }

    /**
     * 获取模块信息
     * */
    public Map<String, String> getMap()
    {
        Map<String, String> da = Rock.getMap();
        if(!Rock.isEmpt(this.name))da.put("name", this.name);
        if(!Rock.isEmpt(this.num))da.put("num", this.num);
        if(!Rock.isEmpt(this.type))da.put("type", this.type);
        if(!Rock.isEmpt(this.table))da.put("table", this.table);
        if(!Rock.isEmpt(this.imgurl))da.put("imgurl", this.imgurl);
        if(this.where != null)da.put("where", this.where);
        if(!Rock.isEmpt(this.summary))da.put("summary", this.summary);
        if(!Rock.isEmpt(this.summarx))da.put("summarx", this.summarx);
        if(this.sericnum != null)da.put("sericnum", this.sericnum);
        if(this.sortdir != null)da.put("sortdir", this.sortdir);
        if(!Rock.isEmpt(this.explain))da.put("explain", this.explain);
        if(this.status != -1)da.put("status", this.status+"");
        if(this.isxt != -1)da.put("isxt", this.isxt+"");
        if(this.sort != -1)da.put("sort", this.sort+"");
        if(this.istj != -1)da.put("istj", this.istj+"");
        if(this.islc != -1)da.put("islc", this.islc+"");
        return da;
    }
}
